/*
 *@description:发现页面
 *@Author:@rennan
 *@Date:2024-07-12 14:58:11
 *@version: V1.0.0
*/

<template>
  <div class="my_discovery">
    <!-- 轮播图区域 -->
    <van-swipe :autoplay="3000" lazy-render>
      <van-swipe-item v-for="image in images" :key="image">
        <img :src="image" width="100%" height="200px" />
      </van-swipe-item>
    </van-swipe>

    <!-- 宫格导航区域 -->
    <van-grid :border="false" :column-num="4">
      <van-grid-item v-for="item in gridData" :key="item.id">
        <van-image :src="item.imgUrl" height="40px" />
        <div class="grid_text">{{ item.text }}</div>
      </van-grid-item>
    </van-grid>

    <!-- 发现好歌单 -->
    <div class="music_list">
      <div class="text">发现好歌单</div>
      <van-button plain round type="default" size="small">
        <span>查看更多</span>
      </van-button>
    </div>
    <!-- 歌单列表 -->
    <van-row :gutter="[20, 20]">
      <van-col span="12" v-for="item in musicList" :key="item.id" @click="toMusicList(item.id)">
        <img :src="item.musicImg" alt="" width="100%" height="180px">
        <div>{{ item.auth }}</div>
      </van-col>
    </van-row>
  </div>
</template>
<script setup>
import { ref } from 'vue'
// 宫格数据
const gridData = ref([
  { id: 1, imgUrl: 'https://img.51miz.com/Element/00/23/81/79/3c43ec93_E238179_886f5896.png', text: "每日推荐" },
  { id: 2, imgUrl: 'https://img.zcool.cn/community/010d565a029a3ba801202b0c534c12.jpg@2o.jpg', text: "私人FM" },
  { id: 3, imgUrl: 'https://img1.baidu.com/it/u=1840210225,1835332781&fm=253&fmt=auto&app=138&f=JPEG?w=600&h=400', text: "歌单" },
  { id: 4, imgUrl: 'https://bpic.588ku.com/element_origin_min_pic/19/12/19/21c172e2416f2140317925403148d06d.jpg', text: "排行榜" },
])

// 歌单数据
const musicList = ref([
  {id:1,musicImg:'https://img2.baidu.com/it/u=2725870695,146604262&fm=253&fmt=auto&app=138&f=JPEG?w=300&h=300',auth:'Step(Gran)'},
  {id:2,musicImg:'https://img0.baidu.com/it/u=612155091,2271578341&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',auth:'COSMIC(Lay)'},
  {id:3,musicImg:'http://t14.baidu.com/it/u=1682555268,1913359030&fm=224&app=112&f=JPEG?w=500&h=500',auth:'UNTOLD(BTS)'},
  {id:4,musicImg:'https://img2.baidu.com/it/u=365789535,1107969898&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',auth:'RANDOM(MK)'}
])

// 轮播图静态数据
const images = [
  'https://img2.baidu.com/it/u=3600899980,1842814965&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
  'https://imgs.aixifan.com/content/2018_10_21/1.5401258655421753E9.png',
  'https://ww3.sinaimg.cn/large/005PPkF0jw1ex20d6cu50j315o15oh5x.jpg'
];

// 跳转歌单详情页面
const toMusicList = (id)=>{
  console.log('跳转歌单详情',id);
}
</script>
<style scoped>
.my_discovery {
  margin-top: 10px;
  padding: 0 10px;
  height: calc(100vh - 110px);
  overflow-y: scroll;
}

.grid_text {
  font-size: 15px;
}

.music_list {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.music_list .text {
  color: #000;
  font-size: 18px;
  font-weight: 600;
}

.music_list span {
  color: #000;
}</style>